Repository navigation
Post-D1 SDK fixes, integrated (0.4.0) - #17
Merged
Merged
Conversation
…s, and a weekly audit that opens an issue on failure (A-40)
…ittered backoff (RetryPolicy, DRUMS_RETRY_MAX_WAIT_S); fall back to certifi when the system certificate store fails, else CertificateError with the fix
… has no Python 3.9 (main fails the same way)
…s a run, buffers step() points and flushes at most once per 30 s, closes on exit, labels the desktops created inside; a no-op with one warning on a gateway without the run routes
…admission, rate limit, quota, spend cap and task set before a run; drums.preflight() in Python
…ng; README section
…oken mode; renew before expiry and after a 401; no secret in reprs or errors
…sk_set, a task document sent as a JSON string, and verify with no task says so (same tool list and messages as the gateway)
… 0.4.0 (not published)
…3.9; the same line as #10)
…3.9; the same line as #10)
…3.9; the same line as #10)
…3.9; the same line as #10)
…3.9; the same line as #10)
# Conflicts: # drums/__init__.py
# Conflicts: # drums/mcp.py
# Conflicts: # CHANGELOG.md
…ack and RetryPolicy (429 with Retry-After; 5xx and dropped connections too in token mode); a key sent before the auth mode was known is retried once after a 401
…ipted_test kind (eval accepted), desktops_provisioned on open and steps, the label from the open reply, a 409 on heartbeat or close ends the run with one warning and no retries, a 403 says computers:write also suffices
…nsole that cannot issue a token is an auth failure, both mode on the key is a warning; the console row defaults to the token URL's origin) and reads GET /v1/limits as Drums-Labs/drums#49 serves it (admission down fails, host capacity from the limits, rate profile, a 403 names usage:read); runs:write is no longer wanted
…s and an upgrade note for 0.3 users
…s hash and a summary of its scalar top-level values, with one warning; a 400 on open warns with the gateway's message and leaves run.id None (only 404/405 mean no run routes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One branch with every post-D1 SDK pull request merged into it, the conflicts between them resolved, and the follow-ups the console and gateway side asked for. It proposes 0.4.0. Nothing is published: no tag, nothing on PyPI.
Merged from
origin/main, with merge commits, in this order:fix/w7-dependency-audit: pip-audit gate, weekly audit, test matrix on ubuntu-24.04 (A-40)fix/w4-retry-after-certs: Retry-After on every call, certifi fallback (A-29, A-07)fix/w2-token-exchange: API key to desktop token exchange (A-30)fix/w4-run-object: run object client (A-36)fix/w4-preflight:drums preflightfix/w4-mcp-custom-tasks: MCP custom tasks (A-08, A-09)fix/w4-release-0.4.0: CHANGELOG and version 0.4.0Conflicts resolved
drums/__init__.py(Retry 429s on every call with Retry-After and jitter; certifi fallback for macOS certificates #11 and SDK: exchange the API key for a desktop token when the gateway asks for it #14): both sets of helpers kept (RetryPolicy,_retry_after, the certifi helpers,_Credentials). InClient.__init__the certifi flag and the credentials are both set. Incall()the 429 retry and the 401 token renewal both apply: the 429 check runs first, then the 401 renewal.drums/mcp.py(Retry 429s on every call with Retry-After and jitter; certifi fallback for macOS certificates #11 and drums mcp: custom tasks by task set, list/get task sets, verify without a task says so #15): one import line withRetryPolicyandBadRequest.CHANGELOG.md(SDK: exchange the API key for a desktop token when the gateway asks for it #14 and CHANGELOG for the post-D1 SDK fixes; propose 0.4.0 (not published) #16): one 0.4.0 section. It was then rewritten to describe the combined release.ci.yml: ci: pip-audit gate and a weekly dependency audit (A-40) #10, Retry 429s on every call with Retry-After and jitter; certifi fallback for macOS certificates #11, Run object: open a training run, buffer its steps, close it, label its desktops #12, drums preflight: check a run can start before any GPU is paid for #13, drums mcp: custom tasks by task set, list/get task sets, verify without a task says so #15 and CHANGELOG for the post-D1 SDK fixes; propose 0.4.0 (not published) #16 each carry the sameubuntu-24.04line, so it merged cleanly.Follow-ups added here
Run object, to match the gateway's trainer runs (Drums-Labs/drums#41):
scripted_testis no longer a run kind. The kinds aretraining,rl,evaluationandeval(evalis the gateway's own name).desktops_provisionedis sent on open (client.run(..., desktops_provisioned=N)) and per step (run.step(..., desktops_provisioned=N)).label. When another running run already holds the name, the gateway answers<label>-<4 of id>, and desktops created later get that label.run.endedsays why. A 409 on close is quiet. Before this, a 409 on PATCH put the points back in the buffer, and they were sent again on every flush.computers:writealso suffices.Token exchange (#14) with #11:
Client._build_opener. That gives it the same redirect policy plus certifi's bundle once the client uses it. A certificate failure at the console switches the client to certifi once, with one stderr line naming the console. Without certifi it raisesCertificateErrornaming the console.GET /auth) also switches to certifi on a certificate failure, so discovery, exchange and calls agree.RetryPolicy. A 429 waits at least itsRetry-After, andmax_wait_s=0turns this off. Intokenmode with no valid token there is nothing to fall back to, so a 5xx or a dropped connection is retried within the same budget too. Inbothmode, or while the old token is still valid, these are not retried, and the client falls back at once as before.Preflight (#13):
/v1/health, so a console that cannot issue a token shows as anauthfailure, not "gateway down". A refused key at the console is an auth failure. Aboth-mode gateway running on the key alone is a warning. The auth row says when a desktop token was used._limits_viewwas checked against the reply in Drums-Labs/drums#49. Every field it reads is there with the same name, and a test replays that exact document. It now also readshost.admission(downfails the admission row),host.max_desktops/live/free(host capacity when/v1/healthhas none), andworkspace.rate_limit_profile(shown on the rate row)./v1/limitssays the key lacksusage:read.runs:writeis no longer a wanted scope, becausecomputers:writeopens runs (#41).Docs: the CHANGELOG describes the combined 0.4.0. The README gets a desktop tokens note, the preflight table update, the run object changes, and an "Upgrading from 0.3" section (nothing breaks, what is new, the 429 off switch).
How it was tested
python -m unittest discover -s tests: 158 tests, OK locally on 3.12, 3.9 and 3.13 (uv). CI runs 3.9 to 3.13 on ubuntu-24.04, plus pip-audit.test_tokens.py: 429 Retry-After on the exchange; 5xx retried in token mode; the off switch;bothmode does not wait; renewal after a 401 retries a 429; resend after an unanswered discovery; certifi fallback at the console, with and without certifi; a client already on certifi uses it for the exchange.test_runs.py: kinds;desktops_provisioned; the label from the reply on creates; a 409 heartbeat stops the retries; a quiet 409 on close; the 403 text.test_preflight.py: token mode end to end, where the gateway never sees the key; console down in token mode; refused key;bothfallback warning; console origin default; the exact #49 document; capacity from the limits; 403 on limits.Not done here
Nothing is merged into
main, and nothing is released. The individual PRs stay open; close them once this one lands.